//
//  LoginController.m
//  20240823
//
//  Created by 张伟 on 2024/8/25.
//

#import "LoginController.h"
#import "RegisterController.h"

@interface LoginController ()
@property (weak, nonatomic) IBOutlet UITextField *account;
@property (weak, nonatomic) IBOutlet UITextField *password;

@end

@implementation LoginController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"账号登录";

}	

- (IBAction)loginAction:(UIButton *)sender {
    if (_account.text.length == 0) {
        [ZWHud showMessage:@"账号不能为空" finishHandle:nil];
        return;
    }
    
    if (_password.text.length == 0) {
        [ZWHud showMessage:@"密码不能为空" finishHandle:nil];
        return;
    }
    
    MJWeakSelf
    [NetService requestLogin:_account.text password:_password.text successHandle:^{
        [ZWHud showMessage:@"登录成功" finishHandle:nil];
        [weakSelf dismissViewControllerAnimated:true completion:nil];
    } fail:^{
        
    }];
}



//注册事件
- (IBAction)registerAction:(UIButton *)sender {
    [self.navigationController pushViewController:RegisterController.new animated:true];
}


@end
